package com.omg.util;

import org.springframework.context.ApplicationContext;

public class ApplicationContextUtil {

	private static ApplicationContext appicationContext;
	
	public static void initApplicationContext(ApplicationContext appContext){
		if (null == appicationContext){
			synchronized (Object.class) {
				if (null == appicationContext){
					appicationContext = appContext;
				}
			}
		}
	}
	
	public static Object getBean(String beanName){
		if (null != appicationContext){
			return appicationContext.getBean(beanName);
		}
		return null;
	}
}
